import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      //地址重定向, 点击跳转链接就能直接跳到首页.
      path: "/",
      redirect: '/c-oj/home/question',
    },
    {
      path: '/c-oj/home',
      name: 'home',
      component: () => import("@/views/Home.vue"),  
      children: [
        {
          path: 'question',
          name: 'question',
          component: () => import("@/views/Question.vue"),
          meta: {showBanner: true} //展示banner图
        },
        {
          path: 'exam',
          name: 'exam',
          component: () => import("@/views/Exam.vue"),
          meta: {showBanner: true} //展示banner图
        },
        {
          path: 'user/exam',
          name: 'userExam',
          component: () => import("@/views/UserExam.vue"),
          meta: {showBanner: false} //不展示banner图
        },
        {
          path: 'user/detail',
          name: 'userDetail',
          component: () => import('@/views/UserDetail.vue'),
          meta: {showBanner: false}
        },
        {
          path: 'user/message',
          name: 'userMessage',
          component: () => import('@/views/UserMessage.vue'),
          meta: {showBanner: false}
        },
      ]
    },
    {
      path: '/c-oj/login',
      name: 'login',
      component: () => import("@/views/Login.vue")
    },
    {
      path: '/c-oj/anwser',
      name: 'anwser',
      component: () => import("@/views/Answer.vue")
    },
  ],
})

export default router
